package com.yuanxing.oushangyidali.ui.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter

class FragmentAdapter(fm: FragmentManager?, fragments: List<Fragment>) :
    FragmentStatePagerAdapter(
        fm!!,
        FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
    ) {
    private val mFragments: List<Fragment> = fragments
    override fun getItem(position: Int): Fragment = mFragments[position]

    override fun getCount(): Int = if (mFragments.isEmpty()) 0 else mFragments.size


}